1. Field of the Invention
This invention relates generally to computer networking, and more particularly to network stack layer interfaces for efficiently communicating data between network stack layers in a computer network environment.
2. Description of the Related Art
The art of networking computers has evolved over the years to bring computer users a rich communication and data sharing experience. To provide users with such a rich communication experience, standard communication protocols have been developed to improve interoperability between network applications. One such standard is the International Organization for Standard""s (ISO) layered communication protocol model called the Open Systems Interconnection (OSI) Reference Model, which is the most widely utilized network communication standard in use today.
The OSI Reference Model defines how messages are transmitted between nodes of a computer network. Generally, the OSI Reference Model is used as a guide to encourage interoperability among devices provided by various network equipment manufactures. As shown in FIG. 1, the OSI Reference Model 10 includes seven functional layers divided into two groups, host layers 12 and transfer layers 14.
The host layers 12 are utilized when a particular message is transmitted from the host machine or when a message is destined for that particular host machine. The host layers 12 comprise four network stack layers. These include an application layer 16, a presentation layer 18, a session layer 20, and a transport layer 22. The application layer 16 is the layer at which communication partners are identified, quality of service is identified, user authentication and privacy are considered, and constraints on data syntax are identified.
Generally part of the operating system, the presentation layer 18 converts incoming and outgoing data from one presentation format to another. For example, newly arrived text in the form of a text stream may be converted into a popup window. The session layer 20 sets up, coordinates, and terminates conversations, exchanges, and dialogs between applications executing at each end node. Finally, the lowest layer of the host layers 12 is the transport layer 22, which manages end-to-end control and error-checking, ensuring complete data transfer.
The host layers 12 are generally independent of the actual hardware used to form the computer network. However, the transfer layers 14 are not typically independent of the actual hardware used to form the network, and are therefore generally optimized for efficient performance on the particular devices for which they are designed.
The transfer layers 14 are used when any message passes through the host computer, regardless of whether it is intended for that particular host machine or not. Messages destined for another host machine are forwarded to another host, and are not passed up to the host layers 12.
The transfer layers 14 include a network layer 24, a data link layer 26, and a physical layer 28. The-network layer 24 handles the routing and forwarding of data. Since larger networks typically include different types of MAC standards, the network layer 24 is used to facilitate communication between different types of networks.
The data link layer 26 provides error control and synchronization for the physical layer 28 by providing transmission protocol knowledge and management. Finally, the physical layer 28 conveys the bit stream through the network at the electrical and mechanical level.
For each message sent between the users, there is a flow of data through each of the functional layers mentioned above. When transmitting, data flows down through the layers starting with the application layer 16. When the message arrives at the receiving computer, data flows up through the layers starting with the physical layer 24, and ultimately to the end user.
To function properly, communication between the network stack layers must be provided. Hence, data arriving on the physical layer 28 must be provided to the data link layer 26, and then from the data link layer 26 to the network layer 24, and so on up through the rest of the network stack layers. Each network stack layer processes the data and passes it on to the next layer.
Conventionally, copying is used to pass processed data from one network stack layer to the next. Specifically, in a conventional network system, data processed by a particular network stack layer is copied to a buffer. The next network stack layer then reads the data from the buffer, processes it, and copies the processed data into another buffer. This process is then repeated for the rest of network stack layers. In other words, the entire data buffer must be copied to a new buffer each time a new network stack layer needs to access it.
However, copying data into buffers each time a network stack layer needs to pass data to another layer is extremely inefficient. Copying data into buffers is a slow process relative to other processes in the computer network. Moreover, buffer copying requires CPU time that could be better used performing other functions. Thus, conventional networking systems that perform buffer copying when passing data between network stack layers are extremely slow.
In view of the forgoing, there is a need for an interface that provides fast and efficient communication between network stack layers. The interface should avoid buffer copying, yet still provide reliable inter-layer communication. In addition, the interface should be essentially standardized, thus allowing similar routines to use the interface.
Broadly speaking, the present invention fills these needs by providing a network stack layer interface that efficiently facilitates communication between network stack layers. The interface is configured to pass memory address pointers between network stack layers to avoid buffer copying, thus greatly reducing the amount of copying performed during inter-layer communication. In one embodiment, the network stack layer interface includes a header portion defining various characteristics of the network stack layer interface. In addition, a buffer descriptor is included that defines data to be transmitted over the computer network when operating on a transmitting host, or to data that was transmitted over the computer network when operating on a target. The buffer descriptor includes a memory address pointer to the data. In this manner, information is passed between network stack layers via the network stack interface, resulting in fast network data transfer with reduced data copying.
In another embodiment, a method for transmitting data over a computer network via the network stack layer interface is disclosed. The method includes generating a first, second, and third SCSI information descriptor (SID), as described above. The first SID includes a memory address pointer that points to a first memory address of data to be transmitted over the computer network. The memory address pointer is then passed from the first SID to the second SID, and a storage header memory address pointer is further assigned to the second SID. At this point, the storage header memory address pointer and the data memory address pointer are both passed from the second SID to the third SID. The third SID is then assigned a transport header memory address pointer. Finally, a network interface device is afforded access to the third SID and utilizes the third SID to transmit at least a portion of the data over the computer network.
In yet another embodiment, a method for receiving data over a computer network via the network stack layer interface is disclosed. Similar to the transmitting method above, the receiving method includes generating a first, second, and third SCSI information descriptor (SID). In the receiving method, the third SID includes a memory address pointer to a packet buffer that includes data from a received data packet. The memory address pointer is passed from the third SID to the second SID, where it is modified to point to a first offset memory address that is offset from the beginning address of the packet buffer such that transport header data within the packet buffer is skipped. At this point, the memory address pointer from the second SID is passed to the first SID, where it is modified to point to a second offset memory address that is offset from the beginning of the packet buffer such that it addresses a data chunk within the packet buffer. Finally, the data chunk is copied from the data packet to system memory.
Advantageously, the present invention allows communication between layers of the network stack with very little inter-layer data copying, which is a great improvement over conventional network applications. Allowing the data to be obtained from the packet buffers without performing a copy operation for each network stack layer greatly increases the speed and efficiency of the network data transfer.
Moreover, the present invention makes use of a common header portion for each network stack layer interface. This allows the use of common function interfaces for several network stack layers, thus reducing the amount of coding needed to facilitate communication. In addition, common headers increase reliability by reducing the amount of new variables introduced into the system.